package com.mashibing.common.valid;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

@Documented
@Constraint(validatedBy = {ListIntegerConstraintValidator.class, ListLongConstraintValidator.class}) // @Constraint 注解通常用于自定义验证注解，validatedBy 属性指定了用于执行实际验证逻辑的验证器类
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ListValue {

    String message() default "{com.msb.common.valid.ListValue.message}";

    Class<?>[] groups() default {};

    /**
     * 校验不通过时的携带的相关信息
     */
    Class<? extends Payload>[] payload() default {};

    int[] val() default {};
}
